package com.lonely.system.engine.log;

import cn.hutool.core.lang.Assert;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author : 黄志标
 * @date: 2025/6/27 13:08
 * @description: 获取日志时间线业务模块枚举
 */
public enum GetLogTimeModuleEnum {

    /**
     * 尾货库存
     */
    SURPLUS_INVENTORY,

    /**
     * 备货库存
     */
    STOCK_UP_INVENTORY;

    /**
     * 获取指定模块名对应的枚举对象
     *
     * @param moduleName
     * @return
     */
    public static GetLogTimeModuleEnum getInstance(String moduleName) {
        Assert.notNull(moduleName, "模块名称不能为空");
        GetLogTimeModuleEnum getLogTimeModuleEnum = Arrays.stream(GetLogTimeModuleEnum.values()).filter(x -> Objects.equals(x.name(), moduleName)).findFirst().orElse(null);
        Assert.notNull(getLogTimeModuleEnum, String.format("日志模块：%s 不存在", moduleName));
        return getLogTimeModuleEnum;
    }
}
